package com.example.dto;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import io.swagger.v3.oas.annotations.media.Schema;
import io.swagger.v3.oas.annotations.media.SchemaProperty;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * @Author: 谢焕涛
 * @Description: 用户信息DTO
 * @Date: 2025/8/8 上午11:47
 * @Version: 1.0
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)  // 当前属性值为null时，则不进行json序列化
public class UserDTO{

    // 进行排除json序列化,标注在属性上将不会进行json序列化
    @JsonIgnore
    @Schema(description = "id编号")
    private Integer id;

    // 设置字段别名
    @JsonProperty("name")
    @Schema(description = "账号")
    private String userName;

    @Schema(description = "名称")
    private String cName;

    // 进行日期格式化
    @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss", locale = "zh")
    @Schema(description = "日期")
    private Date timeDate;

}
